# 面试高频问题
# 以前的叫法 列表解析

# 还有字典推导式、生成器推导式

# 列表推导式的作用：快速、优雅的生成一个列表

lst = []
for i in range(11):
    not i % 2 and lst.append(i)

# print(lst)

# lst = [x for x in range(10) if not x % 2]
# print(lst)

from dis import dis

def test():
    # lst = []
    # for i in range(11):
    #     not i % 2 and lst.append(i)
    lst = [x for x in range(10) if not x % 2]

dis(test)

# https://walker_kwu.gitee.io/my-blog/2022/07/21/python/advanced/%E6%8E%A8%E5%AF%BC%E5%BC%8F/